package com.offcn.question.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.offcn.common.utils.PageUtils;
import com.offcn.common.utils.Query;

import com.offcn.question.dao.QmsTypeDao;
import com.offcn.question.entity.QmsTypeEntity;
import com.offcn.question.service.QmsTypeService;


@Service("qmsTypeService")
public class QmsTypeServiceImpl extends ServiceImpl<QmsTypeDao, QmsTypeEntity> implements QmsTypeService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        //1,获取关键字
        String key=(String) params.get("key");
        //2,创建查询条件对象
        QueryWrapper<QmsTypeEntity> wrapper = new QueryWrapper<>();
        //3,设置查询条件
        if (StringUtils.isNotEmpty(key)){
            wrapper.eq("id",key).or().like("type",key);
        }

        IPage<QmsTypeEntity> page = this.page(
                new Query<QmsTypeEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}